package edu.neusoft.springmvc.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import edu.neusoft.springmvc.model.User;

@Controller
@RequestMapping("/register")
public class RegController {

  /* @RequestMapping("/getReg")
  public void getRegister(User user, HttpServletResponse response) {
    System.out.println("username:" + user.getUsername() + "password:" + user.getPassword() + "age:" + user.getAge() + "province:"
      + user.getAddress().getProvince() + "city:" + user.getAddress().getCity());
    PrintWriter out = null;
    try {
      out = response.getWriter();
      out.println("username:" + user.getUsername() + "  province:" + user.getAddress().getProvince());
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } finally {
      out.close();
    }
  
  }*/

  @RequestMapping("/getReg")
  public String getRegister(User user, HttpServletRequest request) {
    System.out.println("username:" + user.getUsername() + "password:" + user.getPassword() + "age:" + user.getAge() + "province:"
      + user.getAddress().getProvince() + "city:" + user.getAddress().getCity());

    request.setAttribute("user", user);
    return "registerInfo";

  }

}
